package com.job.ZhangMeng.Homework0715;

public class StringEx02 {

    public static void main(String[] args) {
        String str="qwer007df2200nkvd0019jkl231oopss5hh014";
        String part="0";
        int sum=0;
        for (int i = 0; i < str.length(); i++) {
            if(Character.isDigit(str.charAt(i))){
                part+=str.charAt(i);
            }else {
                sum+=Integer.parseInt(part);
                part="0";
            }
        }
        //如果字符串末尾也是数字,for循环内无法转换并累加
        sum+=Integer.parseInt(part);
        System.out.println(sum);
    }

}
